Add RuleConventionsTest to enforce rule registration conventions#992
Open
mglaman wants to merge 4 commits into
Open
Add RuleConventionsTest to enforce rule registration conventions#992mglaman wants to merge 4 commits into
mglaman wants to merge 4 commits into
Conversation
Adds tests/src/RuleConventionsTest.php which parses rules.neon, extension.neon, and bleedingEdge.neon and asserts that every rule is toggleable: registered via conditionalTags with a boolean default under parameters.drupal.rules, opt-in rules enabled in bleedingEdge.neon, and no new rules added directly under rules:. Graduated rules (default true) are tracked via an explicit allowlist. Fixes the pre-existing convention violation surfaced by the test: pluginManagerInspectionRule was opt-in (false default) but missing from bleedingEdge.neon. Adds AGENTS.md documenting the conventions for contributors and agents, and nette/neon as a dev dependency for parsing the neon files. Closes #971 https://claude.ai/code/session_01AAChSrMEaL4S6st2ET2JRF
The rule is too unreliable to enable for bleeding-edge users. Instead of adding it to bleedingEdge.neon, record the deliberate exception in RuleConventionsTest::OPT_IN_RULES_EXCLUDED_FROM_BLEEDING_EDGE so the conventions test stays green and the exclusion is explicit and documented. Reverts the earlier bleedingEdge.neon addition and documents the exception mechanism in AGENTS.md. https://claude.ai/code/session_01AAChSrMEaL4S6st2ET2JRF
Drop the separate AGENTS.md and document the toggleable-rule conventions in the existing CLAUDE.md instead. Update RuleConventionsTest failure messages to point at CLAUDE.md. https://claude.ai/code/session_01AAChSrMEaL4S6st2ET2JRF
Access the preg_match capture group only inside the `=== 1` branch so PHPStan can prove the offset exists, instead of relying on an assertSame that does not narrow the matches array. https://claude.ai/code/session_01AAChSrMEaL4S6st2ET2JRF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds tests/src/RuleConventionsTest.php which parses rules.neon,
extension.neon, and bleedingEdge.neon and asserts that every rule is
toggleable: registered via conditionalTags with a boolean default under
parameters.drupal.rules, opt-in rules enabled in bleedingEdge.neon, and
no new rules added directly under rules:. Graduated rules (default
true) are tracked via an explicit allowlist.
Fixes the pre-existing convention violation surfaced by the test:
pluginManagerInspectionRule was opt-in (false default) but missing from
bleedingEdge.neon.
Adds AGENTS.md documenting the conventions for contributors and agents,
and nette/neon as a dev dependency for parsing the neon files.
Closes #971
https://claude.ai/code/session_01AAChSrMEaL4S6st2ET2JRF